package com.sunshine.lnuplus.utils

import android.content.Context
import android.graphics.Color
import com.sunshine.lnuplus.R

object ColorUtils {

    private var lessonMap: MutableMap<String, Int> = mutableMapOf()
    private lateinit var context: Context

    fun init(context: Context){
        this.context = context
    }

    fun setBackgroundColor(lessonName: String) : Int{
        if(!lessonMap.containsKey(lessonName)){
            lessonMap[lessonName] = lessonMap.size
        }
        return when (lessonMap[lessonName]?.rem(14)) {
            0 -> context.resources.getColor(R.color.red)
            1 -> context.resources.getColor(R.color.orange)
            2 -> context.resources.getColor(R.color.purple)
            3 -> context.resources.getColor(R.color.shallow_green)
            4 -> context.resources.getColor(R.color.hard_blue)
            5 -> context.resources.getColor(R.color.hard_green)
            6 -> context.resources.getColor(R.color.shallow_blue)
            7 -> context.resources.getColor(R.color.hard_orange)
            8 -> context.resources.getColor(R.color.blue)
            9 -> context.resources.getColor(R.color.green)
            10 -> context.resources.getColor(R.color.hard_purple)
            11 -> context.resources.getColor(R.color.shallow_green2)
            12 -> context.resources.getColor(R.color.hard_pink)
            13 -> context.resources.getColor(R.color.shallow_blue2)
            else -> Color.TRANSPARENT
        }
    }
}